package com.aaa.hospital.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author: danghui
 * @Date: 2021/12/30 10:13
 * @Description: TODO
 */
public class MenuUtil {
    public static List<Map<String,Object>> haha(List<Map<String,Object>> hehe){
        List<Map<String,Object>> objects = new ArrayList<>();

        for (Map<String, Object> stringObjectMap : hehe) {
            if (stringObjectMap.get("type").equals("M")){
                List<Map<String,Object>> subMenu = new ArrayList<>();
                stringObjectMap.put("subMenu",subMenu);
                objects.add(stringObjectMap);
            }
        }
        for (Map<String, Object> stringObjectMap : hehe) {
            for (Map<String, Object> object : objects) {
                if (stringObjectMap.get("mid").equals(object.get("id"))){
                    ((List)object.get("subMenu")).add(stringObjectMap);
                }
            }
        }
        return objects;
    }
}
